package com.abm.adapters;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.abm.R;

public class SearchListAdapter extends BaseAdapter
{
	String[] 		m_data_text;
    int[] 			m_data_image;
    Context 		m_Context;

    SearchListAdapter(Context contex)
    {
    	super();
    	this.m_Context = contex;
    }

    SearchListAdapter(Context contex, String[] text)
    {
    	super();	
    	this.m_Context 	= contex;         
    		m_data_text = text;
    }
    
    
    SearchListAdapter(Context contex, String[] text, int[] image)
    {
    	super();	
    	this.m_Context 	= contex;         
    		m_data_text = text;
            m_data_image = image;
    }

    public SearchListAdapter(Context contex, ArrayList<String> text)
    {
    	super();
    	this.m_Context 	= contex;
    	
    		m_data_text = new String[text.size()];

            for (int i = 0; i < text.size(); i++) 
            {
                m_data_text[i] = text.get(i);
            }
    }
    
    SearchListAdapter(Context contex, ArrayList<String> text, ArrayList<Integer> image)
    {
    	super();
    	this.m_Context 	= contex;
    	
    		m_data_text = new String[text.size()];
            m_data_image = new int[image.size()];

            for (int i = 0; i < text.size(); i++) 
            {
                m_data_text[i] = text.get(i);
                m_data_image[i] = image.get(i);
            }
    }

    public int getCount()
    {
    	return m_data_text.length;
    }

    public String getItem(int position)
    {
    	return null;
    }

    public long getItemId(int position)
    {
    	return position;
    }

    public View getView(int position, View convertView, ViewGroup parent)
    {

        //LayoutInflater inflater = getLayoutInflater();
        LayoutInflater 	inflater 			= LayoutInflater.from(m_Context);
        View row;

        row = inflater.inflate(R.layout.search_list, parent, false);

        TextView textview = (TextView) row.findViewById(R.id.TextView01);
//        ImageView imageview = (ImageView) row .findViewById(R.id.ImageView01);

        textview.setText(m_data_text[position]);
//        imageview.setImageResource(m_data_image[position]);

        return (row);
    }
}

